{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">
                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" id="key" class="layui-input search" name="key" value="" placeholder="公司名称/公司地址"/>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <select name="sheng" lay-search="" id="province"  lay-filter="province">
                                <option value="">---- 请选择省 ----</option>
                                {foreach name="province" item="v1"}
                                <option value="{$v1.district_id}" >{$v1.district}</option>
                                {/foreach}
                            </select>
                        </div>

                        <div class="layui-col-md6 layui-input-inline">
                            <select name="shi" lay-search=""  id="city"  lay-filter="city">
                                <option value="">---- 请选择市 ----</option>
                            </select>
                        </div>

                        <div class="layui-col-md6 layui-input-inline">
                            <select name="qu" lay-search=""  id="district"  lay-filter="district">
                                <option value="">---- 请选择区 ----</option>
                            </select>
                        </div>
                        <div class="layui-input-inline">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--搜索框结束-->
                <!--操作框开始-->
                <div class="col-sm-12">
                <div class="input-group" >
                <button class="btn btn-primary" type="button" onclick="wk.href('{:url('add')}');">
                <i class="fa fa-plus"></i> 添加装修公司
                </button>
                </div>
                </div>
                <!--操作框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <!--图片模板-->
                    <script type="text/html" id="imgTpl">
                        <ul onclick="view(this)" id="view_{{d.id}}">
                            <li><img data-original="{{d.picture}}" src="{{d.picture}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"  /></li>
                            {{# if(d.image.length >= 1){ }}
                            {{# for(var i=0;i<d.image.length;i++){  }}
                            <li style="display:none;"><img data-original="{{d.image[i]}}" src="{{d.image[i]}}" ></li>
                            {{# } }}
                            {{# } }}
                        </ul>
                    </script>
                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        <!--{{# if(d.tuijian == 1){ }}-->
                        <!--<a href="javascript:;" onclick="wk.confirm('{{d.id}}','{:url('tuijianyes')}','你确定要设置为推荐吗?')" class="btn btn-success btn-xs m-r-xs">设置为首页推荐</a>-->
                        <!--{{# } }}-->
                        <!--{{# if(d.tuijian == 2){ }}-->
                        <!--<a href="javascript:;" onclick="wk.confirm('{{d.id}}','{:url('tuijianno')}','你确定要取消推荐吗?')" class="btn btn-success btn-xs m-r-xs">取消首页推荐</a>-->
                        <!--{{# } }}-->
                        <a href="javascript:;" onclick="wk.href('{:url('update')}?id={{d.id}}')" class="btn btn-primary btn-xs m-r-xs" title="编辑"><i class="fa fa-pencil"></i></a>
                        <a href="javascript:;" onclick="wk.confirm('{{d.id}}','{:url('del')}')" class="btn btn-danger btn-xs m-r-xs" title="删除"><i class="fa fa-trash-o"></i></a>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Renovate/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type:'numbers', width: 80, title: '序号'}
                ,{field:'name', width: 80, title: '名称'}
                , {field: 'title', width: '', title: '标题', align: 'center'}
                , {field: 'image', width: '', title: '图片', align: 'center',templet:'#imgTpl'}
                , {field: 'phone', width: 90, title: '公司电话', align: 'center'}
                , {field: 'sheng', width: '80', title: '省', align: 'center'}
                , {field: 'shi', width: '80', title: '市', align: 'center'}
                , {field: 'qu', width: '80', title: '区', align: 'center'}
                , {field: 'address', width: '', title: '公司位置', align: 'center'}
                , {field: 'content', width: '', title: '服务详情', align: 'center'}
                , {fixed: 'right', width: 100, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $('.img-circle').viewer({
                    url: 'data-original',
                });
            }
        });
    });
</script>
</body>
</html>